package com.mall.orders.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.commons.utils.CommonResult;
import com.mall.model.domain.OmsOrderSetting;
import com.mall.orders.service.OmsOrderSettingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 订单设置表(OmsOrderSetting)表控制层
 *
 * @author wishmumu
 * @since 2023-03-11 15:42:55
 */
@Slf4j
@RestController
@RequestMapping("orderSetting")
public class OmsOrderSettingController {
    /**
     * 服务对象
     */
    @Autowired
    private OmsOrderSettingService omsOrderSettingService;

    /**
     * 获取指定订单设置
     *  根据ID获取单条数据
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public CommonResult getOneById(@PathVariable Integer id) {
        OmsOrderSetting orderSetting = omsOrderSettingService.getById(id);
        log.info(orderSetting.toString());
        return CommonResult.success(orderSetting);
    }


    /**
     * 修改指定订单设置
     *
     * @param omsOrderSetting 实体对象
     * @return 修改结果
     */
    @PostMapping("/update/{id}")
    public CommonResult updateById(@PathVariable Integer id, @RequestBody OmsOrderSetting omsOrderSetting) {
        omsOrderSettingService.updateById(id, omsOrderSetting);
        return CommonResult.success("ok");
    }

}

